using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace hud_lib
{
    public class CItem
    {
        public Point Position { get; set; }
        public Point Size { get; set; }

        public event EventHandler OnClick;
        public event EventHandler OnHover;

        public CItem(Point position, Point size)
        {
            m_position = position;
            m_size = size;
        }

        public void Update(MouseState mouseState)
        {
            if (mouseState.X > m_position.X && mouseState.X < (m_position.X + m_size.X)
                && mouseState.Y > m_position.Y && mouseState.Y < (m_position.Y + m_size.Y))
            {
                OnHover(this, new EventArgs());

                if (mouseState.LeftButton == ButtonState.Pressed)
                {
                    OnClick(this, new EventArgs());
                }   
            }
        }

        protected Point m_position;
        protected Point m_size;
    }
}
